home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / system / g2i12.zip / GRP2INI1 < prev    next >
Text File  |  1995-10-30  |  11KB  |  209 lines

  1.  
  2.  
  3.  
  4.        The  following  article appeared in the November 1994 issue  of  PC 
  5.        Computing:
  6.        
  7.        
  8.        Help Column - PC Computing 11-94
  9.        
  10.        By Brian Livingston
  11.        
  12.        Windows users just can't get enough control over the  customization 
  13.        of  their  systems,  it  seems.  The more  they  can  change  their 
  14.        personal setup, the more they want to change it.
  15.        
  16.        Personally,  I think this is a good thing.  Windows allows  you  to 
  17.        customize so many things -the colors, the applications you start up 
  18.        automatically  with  Windows, and so on - that it  keeps  you  from 
  19.        getting  too  serious about the work you're really supposed  to  be 
  20.        doing on your PC.
  21.        
  22.        But  one  of  the aspects of Windows that has been  quite  hard  to 
  23.        manage  is the automation of these customized features.   In  other 
  24.        words, you may want Windows to automatically display certain  icons 
  25.        in Program Manager whenever you boot up your PC, but not when  your 
  26.        children boot it up (determined, perhaps, by which batch file  they 
  27.        run  to  start Windows).  Or you may want the  Program  Manager  to 
  28.        provide a certain group window when your PC or laptop is  connected 
  29.        to a network, but not when it isn't connected.
  30.        
  31.        Fortunately, there is now a new shareware application that can help 
  32.        you automate almost any aspect of Program Manager groups.  Even  if 
  33.        you don't use the Windows Program Manager (because you prefer  some 
  34.        other  shell, such as Norton Desktop for Windows),  this  shareware 
  35.        application  may  give  you ideas about  how  to  automate  various 
  36.        features of your own Windows interface.
  37.        
  38.        Managing ProgMan
  39.        
  40.        Before getting into the details of this shareware program, we  need 
  41.        to understand a little bit about how to automate the  configuration 
  42.        that  comes up when we start Windows, and what the files  are  that 
  43.        make this configuration possible.
  44.        
  45.        The  Windows  Program  Manager  displays  icons  in  a  series   of 
  46.        overlapping windows called group windows.  Each of these groups may 
  47.        contain  one  or more icons, each representing  a  certain  command 
  48.        line, working directory, and icon image.
  49.        
  50.        The  file  in which Windows stores the  information  about  Program 
  51.        Manager group windows is called PROGMAN.INI. This file is described 
  52.        in the sidebar.  PROGMAN.INI contains several lines that name other 
  53.        files,  each  of which defines the contents of  a  different  group 
  54.        window.   These  files  have the extension  GRP.   The  Main  group 
  55.        window,  for  example,  is stored in a  file  named  MAIN.GRP.  The 
  56.        StartUp group file is STARTUP.GRP, and so on.
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.        If  we could control the contents of PROGMAN.INI and all these  GRP 
  64.        files automatically, several alternatives become possible:
  65.        
  66.        *  By creating two different batch files to start Windows, one  for 
  67.        yourself  and  one  for your kids or co-workers,  you  can  make  a 
  68.        different set of group windows appear in Program Manager, depending 
  69.        on the level of trust you have in their abilities.  You could  make 
  70.        Program Manager, for example, show only those icons that  represent 
  71.        games, while making invisible those icons that represent your  word 
  72.        processor, file manager, and so on.  If you let your kids use  your 
  73.        PC,  for  example,  this would allow them to  click  whatever  they 
  74.        wanted,  with no concern that they would accidentally  delete  your 
  75.        important files while playing.
  76.        
  77.        *  If you run a network, you can make different group windows  show 
  78.        up  or  disappear  based  on whether or not  the  PC  is  currently 
  79.        connected  to a working network.  You could use a batch  file  that 
  80.        simply  looks  for  the existence of a common  file  on  a  network 
  81.        server,  and  then edits the Program Manager groups  based  on  the 
  82.        results.
  83.        
  84.        You  can probably think of many other cases in which you'd like  to 
  85.        have a different configuration of Program Manager groups or  icons, 
  86.        depending  on  the  status of your PC (as  determined  by  whatever 
  87.        utility programs you like to use).
  88.        
  89.        The Binary-to-Text Switch
  90.        
  91.        The  new shareware application that gives you this kind of  control 
  92.        is  called  Group-to-Ini  (GRP21NI).   This  unwieldy  name  is   a 
  93.        confusing label for what is really a very simple program.
  94.        
  95.        GRP2INI converts any Program Manager group (.GRP) file into a plain 
  96.        text file, much like WIN.INI, SYSTEM.INI, and other  initialization 
  97.        files that Windows reads when it starts up.
  98.        
  99.        Once  you have converted an unreadable GRP file into a  plain  text 
  100.        file,  you  can use another shareware application,  Config  Control 
  101.        (CFGCNTRL)  to automatically edit it.  This allows you to  edit  in 
  102.        various statements - or edit out statements you don't want -  based 
  103.        on the findings of batch files that you use to start Windows.
  104.        
  105.        Finally,  after  you've  made the edits you want  via  CFGCNTRL  or 
  106.        manually  (in a plain-text editor), you convert the text file  back 
  107.        into  the binary format that Program Manager requires of  its  .GRP 
  108.        files.   When your batch file starts Windows, the  Program  Manager 
  109.        obeys the new GRP files and puts up on screen just those icons  and 
  110.        commands that you put in your automation scripts.
  111.        
  112.        It  sounds  complicated,  but once you've gotten the  hang  of  it, 
  113.        creating  different configurations on the fly can be easy and  give 
  114.        you a tremendous amount of flexibility.
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.        A Tale of Two Batch Files
  122.        
  123.        For  the sake of illustration, let's say that you want  Windows  to 
  124.        come  up in one of two configurations.  One will be for your  kids, 
  125.        and  is started from a batch file called KIDWIN.BAT. The  other  is 
  126.        for you and the other adults in your home or office, and is started 
  127.        from a batch file called BIGWIN.BAT.
  128.        
  129.        If  all  you want to do is make sure that the  kids'  configuration 
  130.        shows  only  the Games group in the Program Manager,  this  can  be 
  131.        handled  easily by Config Control alone.  To make this happen,  the 
  132.        KIDWIN.BAT  batch  file  would call upon  Config  Control  to  edit 
  133.        PROGMAN.INI  and "comment out" all references to groups other  than 
  134.        GAMES.GRP.  That way, when Windows started up, the Program  Manager 
  135.        would show only the Games group window.  Your other groups -  Main, 
  136.        StartUp, and so on - would still be in existence, but would not  be 
  137.        loaded  by Program Manager.  This makes these groups  inaccessible, 
  138.        so your little ones can't fire up the File Manager and delete  your 
  139.        C: drive, bless their hearts.
  140.        
  141.        To Network or Not to Network
  142.        
  143.        On the other hand, you might have a more complicated  configuration 
  144.        problem  in  mind.   One common example  would  be  establishing  a 
  145.        different  set of icons in Program Manager depending on whether  or 
  146.        not  your PC or laptop was connected to a network when Windows  was 
  147.        started.
  148.        
  149.        If  a  network was running, you might want a certain  icon  in  the 
  150.        Network  group  to run a utility from the network  server.   If  no 
  151.        network  was  detected, you might want the same icon  to  launch  a 
  152.        different program located on the local hard disk of the PC.
  153.        
  154.        This  situation would require that you start Windows from  a  batch 
  155.        file (whether AUTOEXEC.BAT or some other file) that detects whether 
  156.        or  not  a  network is running.  To do this,  you  might  insert  a 
  157.        command  that  looks  for  a particular file,  which  can  only  be 
  158.        detected if the network is up:
  159.        
  160.             IF EXIST N:\NETWORK\FILENAME.TXT GOTO NET
  161.        
  162.        A command like this could lead to a :NET section of the batch file, 
  163.        which  would load GRP21NI to convert NETWORK.GRP into a text  file.  
  164.        The  batch  file would then use Config Control to run a  series  of 
  165.        commands, which would revise the meaning of the icon in the Network 
  166.        group that you wish to automatically configure.  INI2GRP would then 
  167.        convert  the  text file back into a GRP file.  Finally,  the  batch 
  168.        file would start Windows, and Program Manager would come up with  a 
  169.        Network group exactly as you had redefined it.
  170.        
  171.        Using GRP21NI and CFGCNTRL
  172.        
  173.        Because  it  is  unwise to write a new GRP file  while  Windows  is 
  174.        running - and because most of the configuration changes, in Windows 
  175.        should  take  place before Windows is started up  Group-To-Ini  and 
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.        Config  Control are DOS command-line programs.  You use  them  like 
  183.        many  other  DOS utilities, by calling them  from  AUTOEXEC.BAT  or 
  184.        other  batch  files  to  operate  automatically  on  your   Windows 
  185.        configuration, using whatever criteria you feel are appropriate  to 
  186.        branch between two or more alternative configurations.
  187.        
  188.        You  can  download  the unlicensed  shareware  files,  G21.ZIP  and 
  189.        CFGCNT.ZIP,  from the PC/Computing forum.  Once you get them,  it's 
  190.        important that you peruse the documentation that accompanies  these 
  191.        programs.  Because they are DOS character-based programs, there are 
  192.        many options that are not apparent from simply running the programs 
  193.        at  the command line.  The programs are relatively easy  to  learn, 
  194.        but  are powerful, so you'll want to know in advance how they  work 
  195.        on  your  files.  Be sure to make backup copies of your  CFG  files 
  196.        before you test these programs.
  197.        
  198.        To  obtain a licensed copy, send $29 for Group-To-Ini, or  $69  for 
  199.        both  Group-To-Ini and Config Control, to TNT, P.O. Box  1791,  San 
  200.        Ramon,  CA 94583.  For credit card orders, call  510-244-5449.  TNT 
  201.        stands  for  "Tessler's Nifty Tools," a series of  handy  utilities 
  202.        that are described in the accompanying documentation files.
  203.        
  204.        If you need to automatically configure Windows on the fly, I  think 
  205.        you'll  find that these programs give you a degree of control  that 
  206.        has previously been very difficult to achieve.
  207.        
  208.        -Brian Livingston
  209.